export const state = () => ({
  name: '小明',
  age: 18,
  fetchSet: '',
  token: ''
})

export const mutations = {
  CHANGE_NAME(state, payload) {
    state.name = payload
  },
  CHANGE_AGE(state, payload) {
    state.age = payload
  },
  SET_FETCH(state, payload) {
    state.fetchSet = payload
  },
  SET_TOKEN(state, payload) {
    state.token = payload
  }
}

export const actions = {
  CHANGE_INFO({ commit, state }, payload) {
    commit('CHANGE_NAME', payload.name)
    commit('CHANGE_AGE', payload.age)
  }
}

export const getters = {
  userInfo(state) {
    return `姓名：${state.name}, 年龄：${state.age}`
  }
}